<%@ page language="java" import="java.util.*, com.zjut.zs.util.tools.*,com.zjut.zs.userinfo.manager.*, com.zjut.zs.userinfo.dao.*,
com.zjut.zs.school.manager.*, com.zjut.zs.school.dao.*,com.zjut.zs.user.manager.*, com.zjut.zs.user.dao.*,com.zjut.zs.userstatus.manager.*, com.zjut.zs.userstatus.dao.*,
com.zjut.an.config.manager.*, com.zjut.an.config.dao.*,com.zjut.an.util.tools.*,com.zjut.an.util.system.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">  
<meta name="renderer" content="webkit"> 
<title>申请撤回 - 招生报名系统</title>
    <script src="css/tailwindcss.css"></script>

<style type="text/css">
	body { font-family: 'Noto Sans SC', sans-serif; background-color: #f8fafc; }
	.select1 {
		border:1px solid #ccc;
		padding:8px;
		width:200px;
	}
	.td1 {

	}
	.input-focus {
		transition: all 0.3s ease;
	}
	.input-focus:focus {
		transform: translateY(-1px);
		box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
	}
	.card {
		transition: all 0.3s ease;
	}
	.card:hover {
		transform: translateY(-2px);
		box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
	}
</style>
	</head>
<body>
<jsp:include page="zs_uservalidate.jsp" flush="true"/>
<%
if (session.getAttribute("zsUser") == null&&session.getAttribute("admin") == null) {
	out.print("<script>alert('由于长时间未操作，系统已经自动注销，请重新登陆');</script>");
	out.print("<script>top.window.location='main.jsp';</script>");
} else {
ZsSchoolManager zsManager = (ZsSchoolManager) SpringContextUtil.getBean("ZsSchoolManager");
ZsSchool school = new ZsSchool();
school = (ZsSchool)zsManager.getDataByInstance(1,1,null,null,school).getObjects().get(0);
AnConfigManager anconfig = (AnConfigManager) SpringContextUtil.getBean("AnConfigManager");
ZsHTMLCreat html = (ZsHTMLCreat) SpringContextUtil.getBean("ZsHTMLCreat");
ZsUserManager umanager = (ZsUserManager) SpringContextUtil.getBean("ZsUserManager");
ZsUserStatusManager smanager = (ZsUserStatusManager) SpringContextUtil.getBean("ZsUserStatusManager");

ZsUser user = null;
if(session.getAttribute("admin")!=null && request.getParameter("usId")!=null) {
	String usId = request.getParameter("usId");
	user = umanager.getData(usId);
} else if (session.getAttribute("zsUser")!=null) {
	user = (ZsUser)session.getAttribute("zsUser");
}
ZsUserStatus userstatus = smanager.getDataByUser(user);
String key = MD5.toMD5(user.getUsId().toString());
 %>


		<div class="max-w-4xl mx-auto px-4 py-8">
			<!-- 页面标题 -->
			<div class="text-center mb-8">
				<h1 class="text-2xl font-bold text-gray-900 mb-2">申请撤回材料确认</h1>
				<p class="text-gray-600">申请撤回到材料未确认状态（管理员审核通过后可以重新填写信息，修改后需要重新确认材料）</p>
			</div>

			<!-- 撤回信息填写卡片 -->
			<div class="card bg-white rounded-xl shadow-sm p-6 mb-8">
				<div class="text-center">
					<form id="ff2" name="add2" role="form" class="form-horizontal" action="javascript:send2();" method="post">
						<div class="space-y-4">
							<%
							if (!Status.ON.getStatus().equals(school.getScBackActive())){
							%>
							<div class="bg-gray-100 rounded-lg p-4 text-center">
								<svg class="w-12 h-12 text-gray-400 mx-auto mb-3" fill="currentColor" viewBox="0 0 20 20">
									<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/>
								</svg>
								<button type="submit" id="button" class="px-6 py-3 bg-gray-400 text-gray-700 rounded-lg cursor-not-allowed font-medium" disabled>已经关闭</button>
							</div>
							<%
							} else if (Status.APPSTATUS_YES.getStatus().equals(userstatus.getAppStatus()) && Status.CHECKSTATUS_NULL.getStatus().equals(userstatus.getCheckStatus()) ) {
							%>
							<div class="space-y-4">
								<div class="flex flex-col sm:flex-row sm:items-center gap-4">
									<label for="message2" class="text-sm font-medium text-gray-700 sm:w-20">申请原因：</label>
									<input id="message2" name="message2" type="text" class="input-focus px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors duration-200" required data-rule-chinese="true" data-msg-chinese="请输入中文" value="" size="30" maxlength="30" placeholder="请输入撤回原因"/>
								</div>
								<button type="submit" id="button" class="w-full sm:w-auto px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200 font-medium">
									申请撤回材料
								</button>
							</div>
							<%
							} else if (Status.APPSTATUS_NO.getStatus().equals(userstatus.getAppStatus()) ||Status.APPSTATUS_NOTIME.getStatus().equals(userstatus.getAppStatus())){
							%>
							<div class="bg-yellow-50 border border-yellow-200 rounded-lg p-4 text-center">
								<svg class="w-12 h-12 text-yellow-500 mx-auto mb-3" fill="currentColor" viewBox="0 0 20 20">
									<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/>
								</svg>
								<button type="submit" id="button" class="px-6 py-3 bg-yellow-400 text-yellow-800 rounded-lg cursor-not-allowed font-medium mb-3" disabled>已经撤回</button>
								<p class="text-yellow-700 text-sm">请尽快修改材料，重新确认材料</p>
							</div>
							<%
							} else if (Status.APPSTATUS_BACK.getStatus().equals(userstatus.getAppStatus())){
							%>
							<div class="bg-blue-50 border border-blue-200 rounded-lg p-4 text-center">
								<svg class="w-12 h-12 text-blue-500 mx-auto mb-3" fill="currentColor" viewBox="0 0 20 20">
									<path fill-rule="evenodd" d="M2.166 4.999A11.954 11.954 0 0010 1.944 11.954 11.954 0 0017.834 5c.11.65.166 1.32.166 2.001 0 5.225-3.34 9.67-8 11.317C5.34 16.67 2 12.225 2 7c0-.682.057-1.35.166-2.001zm11.541 3.708a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
								</svg>
								<button type="submit" id="button" class="px-6 py-3 bg-blue-400 text-blue-800 rounded-lg cursor-not-allowed font-medium mb-3" disabled>已经申请撤回</button>
								<p class="text-blue-700 text-sm">请等待管理员审核</p>
							</div>
							<%
							}  else if (!Status.CHECKSTATUS_NULL.getStatus().equals(userstatus.getCheckStatus()) ){
							%>
							<div class="bg-gray-100 rounded-lg p-4 text-center">
								<svg class="w-12 h-12 text-gray-400 mx-auto mb-3" fill="currentColor" viewBox="0 0 20 20">
									<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/>
								</svg>
								<button type="submit" id="button" class="px-6 py-3 bg-gray-400 text-gray-700 rounded-lg cursor-not-allowed font-medium" disabled>已经初审</button>
							</div>
							<%
							} else {
							%>
							<div class="bg-gray-100 rounded-lg p-4 text-center">
								<svg class="w-12 h-12 text-gray-400 mx-auto mb-3" fill="currentColor" viewBox="0 0 20 20">
									<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/>
								</svg>
								<button type="submit" id="button" class="px-6 py-3 bg-gray-400 text-gray-700 rounded-lg cursor-not-allowed font-medium" disabled>尚未确认材料</button>
							</div>
							<%
							}
							%>
						</div>
					</form>
				</div>
			</div>

			<!-- 申请撤回需知 -->
			<div class="bg-blue-50 border border-blue-200 rounded-lg p-6">
				<h3 class="text-lg font-semibold text-blue-900 mb-3 flex items-center">
					<svg class="w-5 h-5 text-blue-500 mr-2" fill="currentColor" viewBox="0 0 20 20">
						<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/>
					</svg>
					申请撤回需知
				</h3>
				<div class="text-blue-800 text-sm leading-relaxed">
					<%out.print(anconfig.getSingleConfigInfoByName("申请撤回需知")); %>
				</div>
			</div>
		</div>

<script src="../plugins/assets/plugins/jquery-3.5.1.min.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/jquery-validation-1.14.0/dist/jquery.validate.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/jquery-validation-1.14.0/dist/jquery.metadata.js" type="text/javascript"></script>
<script src="js/formvalidate.js" type="text/javascript"></script>
<script src="../admin/js/publicManager.js" type="text/javascript" charset="utf-8"></script>

		<script type="text/javascript">

var loactionurl = 'zs_sendback.jsp';

function send2() {
	if(confirm("‘申请撤回材料确认’后请等待管理员审核通过。是否确认提交？")) {
		var message = $("#message2").val();
		$.ajax({
	    	cache: false,
	    	type: "GET",
	        url:'../zsUserAppSendBack.action?usId=<%=user.getUsId()%>&key=<%=key%>&message='+message+'&randnum='+Math.floor(Math.random()*1000000),
	        data:{},// 你的formid
	        async: false,
	        error: function(request) {
	        	alert("提交有误");
	        },
	        success: function(data) {
	            alert("提交成功");
	            if ("undefined" != typeof loactionurl) {
	            	top.window.location = 'index.jsp';
	            }
	        }
	    });
	}
}
		</script>
<%} %>

	</body>

</html>